home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 330 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  49 lines

  1. Path: thor.tu.hac.com!collins
  2. From: collins@thor.tu.hac.com (Ron Collins)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Array Parameters
  5. Date: 4 Jan 1996 14:07:08 GMT
  6. Organization: Advanced Depot Systems
  7. Message-ID: <4cgmuc$k9k@hacgate2.hac.com>
  8. References: <wayne.820650643@hawk> <4ce349$4j9@hacgate2.hac.com> <820701694snz@genesis.demon.co.uk> <4cg104$qmp@nervous.pdb.sni.de>
  9. NNTP-Posting-Host: thor.tu.hac.com
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Josef Moellers (mollers.pad@sni.de) wrote:
  13. : In <820701694snz@genesis.demon.co.uk> Lawrence Kirby <fred@genesis.demon.co.uk> writes:
  14.  
  15. : [ ... ]
  16.  
  17. : >                            It is impossible
  18. : >to specify an array as a function parameter since, as in the example above,
  19.  
  20. : Well, if you MUST pass an array by value and not by reference, wrap it
  21. : into a structure:
  22.  
  23. : struct foo {
  24. :     int array[100];
  25. : };
  26. : ...
  27.  
  28.  
  29. I don't get it ... what does this buy me ("me" == any competant C programmer)?
  30. I'm still going to get a pointer-to-something, whether it's a pointer-to-
  31. structure, pointer-to-array, or pointer-to-first-element.  I still need to
  32. know which one is used so I can access the array elements properly.  (Although,
  33. there is seldom any difference between passing a pointer to an array, and
  34. a pointer to the first element of that array).
  35.  
  36. BTW, passing a pointer to an object is _not_ the same as pass by reference.
  37. C does not support pass-by-reference at all.
  38.  
  39.  
  40.  
  41.                         -- Collins --
  42.                         
  43. -----
  44. The views expressed here are mine alone.
  45.  
  46. Ron Collins/Hughes Aircraft Company/M20,P20/Tucson Az 85706
  47. rcollins@thor.tu.hac.com    collins@seagull.rtd.com
  48. ยก----
  49.